Simplify paging size argument. If a negative number is specified, it
means the entire guest memory should be paged out. This is useful for
debugging. Also limit num_pages to the guests max_pages.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
domain_id = atoi(argv[1]);
num_pages = atoi(argv[2]);
- victims = calloc(num_pages, sizeof(xenpaging_victim_t));
-
/* Seed random-number generator */
srand(time(NULL));
return 2;
}
+ if ( num_pages < 0 || num_pages > paging->domain_info->max_pages )
+ {
+ num_pages = paging->domain_info->max_pages;
+ DPRINTF("setting num_pages to %d\n", num_pages);
+ }
+ victims = calloc(num_pages, sizeof(xenpaging_victim_t));
+
/* ensure that if we get a signal, we'll do cleanup, then exit */
act.sa_handler = close_handler;
act.sa_flags = 0;